package com.pengtu.gsj.dao.yh;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.stereotype.Repository;

import com.pengtu.gsj.dao.hibernate.HibernateDao;
import com.pengtu.gsj.entity.yh.DamageDisease;

@Repository
public class DamageDiseaseDao extends HibernateDao<DamageDisease, String>{

	public String getMaxDate() throws ParseException{
		String hql="select max(createDate) from DamageDisease ";
		Date maxDate = (Date) this.createQuery(hql).uniqueResult();
		String lastDate = null;
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		if (maxDate == null) {
			maxDate = sdf.parse("2010-08-06 00:00:00");
		}
		maxDate = new Date(maxDate.getTime() + 1000);
		if (maxDate != null) {
			lastDate = sdf.format(maxDate);
		}
		return lastDate;
	}
}
